#include <REGX52.H>

void Delay(unsigned  int xms)		//@11.0592MHz
{ while(xms>0)
	{unsigned char i, j;

	
	i = 2;
	j = 199;
	do
	{
		while (--j);
	} while (--i);
		xms--;
	}
	
}


void main()
{
	unsigned char lednum;
	while(1)
	{
		if(P3_1==0)
		{
			Delay(15);
			while(P3_1==0);
			Delay(15);
			lednum++;
			if(lednum>=8)
					lednum=0;
			P2=~(0x01<<lednum);
			
		}
	}
}